/**  
* @Title: OrderController.java  
* @Description: TODO(用一句话描述该文件做什么)  
* @author 张鑫
* @phone 17561783855  
* @date 2019年4月10日  
*/
package com.fortune.rainshineservice.controller;

import com.fortune.rainshinecommon.base.MsgModel;
import com.fortune.rainshinecommon.base.ParmsModel;
import com.fortune.rainshinecommon.model.service.OrderDetailModel;
import com.fortune.rainshinecommon.model.service.OrderModel;
import com.fortune.rainshineservice.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**  
* @ClassName: OrderController  
* @Description: TODO(这里用一句话描述这个类的作用)  
* @author 张鑫
* @phone 17561783855
* @date 2019年4月10日  
*    
*/
@RestController
@RequestMapping("/order")
public class OrderController {
	@Autowired
    private OrderService orderService;

	@PostMapping("/list")
    public MsgModel productList(@RequestBody ParmsModel parm){
        return orderService.list(parm);
    }
	
	@PostMapping("/detailOrders")
    public List<OrderDetailModel> getDetailOrders(@RequestBody String id){
        return orderService.getDetailOrders(id);
    }
	
	/**
	 * @Title: confirmingAnOrder
	 * @Description: 卖方确认出货
	 * @author zhangxin
	 * @phone 17561783855
	 * @date 2019年5月14日
	 */
	@PostMapping("/confirming")
    public MsgModel confirmingAnOrder(@RequestBody OrderModel model){
        return orderService.confirmingAnOrder(model);
    }
	
	/**
	 * @Title: receivingAnOrder
	 * @Description: 买方确认收货
	 * @author zhangxin
	 * @phone 17561783855
	 * @date 2019年5月14日
	 */
	@PostMapping("/receiving")
    public MsgModel receivingAnOrder(@RequestBody OrderModel model){
        return orderService.receivingAnOrder(model);
    }

    /**
     * @Title: getOrderDetail
     * @Description: 获取订单详情
     * @author zhangxin
     * @phone 17561783855
     * @date 2019年5月30日
     */
    @PostMapping("/getOrderDetail")
	public MsgModel getOrderDetail(@RequestBody OrderModel orderModel){
        return orderService.getOrderDetail(orderModel);
    }

	@PostMapping("/getByOrderCode")
	public OrderModel getByOrderCode(@RequestBody String orderCode){
		return orderService.getByOrderCode(orderCode);
	}
	
	/**
     * @Title: getOrderDetail
     * @Description: 买卖双方取消订单
     * @author zhangxin
     * @phone 17561783855
     * @date 2019年5月30日
     */
    @PostMapping("/cancelOrder")
	public MsgModel cancelOrder(@RequestBody OrderModel orderModel){
        return orderService.cancelOrder(orderModel);
    }
}
